package chapter02

import java.io.{File, PrintWriter}

import scala.io.Source

object Test05_FileIO {

  def main(args: Array[String]): Unit = {

    //1 从文件中读取数据
    Source.fromFile("D:\\dashuju\\project\\hadoop\\scala\\scala_tutorial\\src\\main\\resources\\test.txt").foreach(print)


    //2、将数据写入文件
    val printWriter = new PrintWriter(new File("D:\\dashuju\\project\\hadoop\\scala\\scala_tutorial\\src\\main\\resources\\hxx.txt"))
    printWriter.println("hello scala for java writer")
    printWriter.close()
  }
}
